package com.ztman.rxjava.server.apiServer;

import com.squareup.okhttp.RequestBody;
import com.ztman.rxjava.model.baseEntity.BaseResponse;
import com.ztman.rxjava.model.entityExtends.upload.UoloadFileMulti;
import com.ztman.rxjava.model.entityExtends.upload.UploadFile;

import java.util.Map;

import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.http.PartMap;
import rx.Observable;

/**
 * Created by YJH on 2017/11/30.
 * 功能：上传文件的api
 */

public interface UploadFileApi {
    /**
     * 功能：单文件上传
     *
     * @param requestBody
     * @return
     */
    @Multipart
    @POST("Uploader/DoImageUploadByStream")
    Observable<BaseResponse<UploadFile>> uploadFileSingle(@Part("file\"; filename=\"avater.jpg") RequestBody requestBody,
                                                          @Part("accountId") long id);

    /**
     * 功能：多文件上传
     *
     * @param id
     * @param params
     * @return
     */
    @Multipart
    @POST("Uploader/DoImageBatchUpload")
    Observable<BaseResponse<UoloadFileMulti>> uploadFileMulti(@PartMap Map<String, RequestBody> params,
                                                              @Part("accountId") long id);
}
